package com.example.leetdemo.finash;

import java.util.HashSet;
import java.util.Set;

public class Solution1103 {

    public static int[] distributeCandies(int candies, int num_people) {
        int[] num_candies = new int[num_people];
//        int ttt = (num_people * num_people + num_people) / 2;
//        int pe = (candies / ttt), t = candies % ttt;
//        if (pe > 0) {
//            for (int i = 0; i < num_people; i++) {
//                num_candies[i] = (pe * (i + 1) + pe * pe ) / 2;
//            }
//        }
        int i = 0;
        while (candies > 0) {
            num_candies[i % num_people] += Math.min(i + 1, candies);
            candies -= Math.min(i + 1, candies);
            i++;
        }
        return num_candies;
    }

    public static void main(String[] args) {
//        int[] t = distributeCandies(10, 3);
//        for (int i = 0; i < t.length; i++) {
//            System.err.print(t[i] + " ");
//        }

        Set<Integer> set = new HashSet<>();
        set.add(11);
        for (Integer aa : set) {
            System.err.println(aa);
        }
    }

}
